package lanqiao14;
// OK

public class B {

	private static String[] dataBase = {"1111110", "0110000", "1101101", "1111001", "0110011",
										"1011011", "1011111", "1110000", "1111111", "1111011"};
	private static String[] datas = {"0000011", "1001011", "0000001", "0100001", "0101011", "0110110",
									 "1111111", "0010110", "0101001", "0010110", "1011100", "0100110",
									 "1010000", "0010011", "0001111", "0101101", "0110101", "1101010"};
	private static int cnt = 0;
	private static int sum = 1;
	public static void main(String[] args) {
		// 循环遍历每个状态码
		for (int i = 0; i < datas.length; i++) {
			f1(0, datas[i]);
			sum *= cnt;
			cnt = 0;
		}
		System.out.println(sum);
		
	}
	
	// 计算该状态码有几种正确可能
	private static void f1(int l_index, String s) {
		if (f2(s)) {
			cnt++;
		}
		char[] c = s.toCharArray();
		for (int i = l_index; i < c.length; i++) {
			boolean temp = false;
			if (c[i] == '0') {
				temp = true;
				c[i] = '1';
				String newS = String.valueOf(c);
				f1(i + 1, newS);
			}
			if (temp) {
				c[i] = '0';
			}
		}
	}

	// 判断这个数是否在数组 dataBase 中
	private static boolean f2(String s) {
		for (int i = 0; i < dataBase.length; i++) {
			if (s.equals(dataBase[i])) {
				return true;
			}
		}
		
		return false;
	}
}

